package com.hiultra.video.service.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hiultra.video.bean.Device;
import com.hiultra.video.service.IVideoManagerStorage;
import com.hiultra.video.util.WVPNetUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 视频设备数据存储-jdbc实现
 * swwheihei
 * 2020年5月6日 下午2:31:42
 */
@SuppressWarnings("rawtypes")
@Component
//@DS("master")
public class VideoManagerStorageImpl implements IVideoManagerStorage {

	private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class);
	@Autowired
	WVPNetUtil wvpNetUtil;
	/**
	 * 获取多个设备
	 *
	 * @param page 当前页数
	 * @param count 每页数量
	 * @return PageInfo<Device> 分页设备对象数组
	 */
	@Override
	public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online) {
		PageHelper.startPage(page, count);
		List<Device> all = null;
		try {
			all = wvpNetUtil.getDevices();
		} catch (JsonProcessingException e) {
			e.printStackTrace();
		}
		return new PageInfo<>(all);
	}
}
